<?php
include 'secure/core.php';
$res_cms = $cms->getPagesList();
if(isset($_POST['submit']))
{
	$result = $cms->saveCms($_POST);
	if($result == true)
	{
		header( 'Location: cms.php?msg=1' ) ;
	}
	else
	{
		header( 'Location: cms.php?msg=2' ) ;
	}		 
}
include 'header.php';
include 'left.php'; 
?>

		<div id="right">
		<div class="section">
		<?php if($_GET['msg'] == '1') { ?>
		<div class="message green"><span><b>Success</b>: CMS Pages have been saved successfully.</span></div>
		<?php } ?>
		<?php if($_GET['msg'] == '2') { ?>
		<div class="message red"><span><b>Error</b>: Error updating CMS Pages.</span></div>
		<?php } ?>
				<div class="box">
					<div class="title">
						Configure CMS Pages
						<span class="hide"></span>
					</div>
					<div class="content">
						<form action="cms.php" method="POST">
						        <?php
  	                                                while($row = $ado->fetch_assoc($res_cms)){
                                                        ?>
							<div class="row">
								<label>Page Name</label>
								<div class="right"><input type="text" name="page_name[]" readonly="readonly" value="<?php echo $row['page_name'];?>"  class="required" /></div>
							</div>
							 <div class="row">
                                            <textarea  name="page_content[]" rows="30" cols="80"  class="required"><?php echo $row['page_content'];?></textarea>
                                                          </div>
                                                          <hr />
							 <?php }?>
							<div class="row">
								<div class="right">
								<button type="submit" class="green" name="submit"><span>Update</span></button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>

<div id="footer">
			<div class="split">Copyright &#169; 2012 - <?php echo $file_path.$file_name; ?> <a href="index.html">Paid4Upload</a>.</div>
			<div class="split right"><a href="http://www.paid4upload.com/forums">Forums</a> | <a href="tos.php">Terms of Service</a> | <a href="dmca.php">DMCA</a></div>
		</div>
	</div>
</div>

</body>


</html> 